package csu.rjxyg.action.userAction;

import java.util.ArrayList;
import java.util.List;

import csu.rjxyg.action.BaseAction;
import csu.rjxyg.bean.core.BaseBean;
import csu.rjxyg.bean.core.BaseList;
import csu.rjxyg.bean.core.BaseObject;
import csu.rjxyg.action.constant.UserConstant;
import csu.rjxyg.factory.core.UtilFactory;
import csu.rjxyg.service.BaseUserService;
import csu.rjxyg.util.LogUtil;

public class GetPermissionInfoAction extends BaseAction {
	private LogUtil log;


	public GetPermissionInfoAction() {
		log = UtilFactory.getLogUtil(getClass());
	}
	
	public void getUserPermission(){
		String name = null;
		try{
			BaseObject object = (BaseObject) this.getSession().get(UserConstant.USER_SESSION);
			name = (String) object.get(UserConstant.USER_ID);
			
			//权限转中文
			object = this.changePermissionName(object);
			List<String> list = (List) object.get(UserConstant.USER_QX);
			
			List string = new ArrayList();
			for( int i = 0 ; i < list.size();i++ ){
				string.add("\"" + list.get(i) + "\"");
			}
			this.out(string.toString());
			//权限转回系统识别
			object = this.changePermissionName(object);
			log.info(name + "获取自己所有权限信息成功");
		}catch(Exception e){
			log.info(name + "获取自己所有权限信息失败");
			e.printStackTrace();
			log.info(e.getMessage());
		}
	}
}
